﻿using System;

namespace FirstFloor.P2P.Reversi
{
    /// <summary>
    /// Represents a location
    /// </summary>
    public class Location
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Location"/> class.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        public Location(int x, int y)
        {
            this.X = x;
            this.Y = y;
        }

        /// <summary>
        /// Gets or set the X coordinate.
        /// </summary>
        /// <value>The X.</value>
        public int X { get; set; }
        /// <summary>
        /// Gets or set the Y coordinate.
        /// </summary>
        /// <value>The Y.</value>
        public int Y { get; set; }

        /// <summary>
        /// Gets the name of the location from image.
        /// </summary>
        /// <param name="imageName">Name of the image.</param>
        /// <returns></returns>
        public static Location GetLocationFromIndex(int index)
        {
            return new Location(index / Board.BoardLength, index % Board.BoardLength);
        }
    }
}
